﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Heavy_Metals
{
    public partial class LYXX_SWDZ : Form
    {
        public LYXX_SWDZ()
        {
            InitializeComponent();
        }

        private void LYXX_SWDZ_Load(object sender, EventArgs e)
        {
            DataGridViewLinkColumn lc = new DataGridViewLinkColumn();
            lc.HeaderText = "删除";
            lc.Name = "删除";
            lc.Width = 60;
            DataGridViewLinkColumn lc1 = new DataGridViewLinkColumn();
            lc1.HeaderText = "查看与修改";
            lc1.Name = "查看与修改";
            lc1.Width = 60;
            this.dataGridView1.Columns.Add("断面名称", "断面名称");
            this.dataGridView1.Columns.Add("所属地区", "所属地区");
            this.dataGridView1.Columns.Add("长", "长");
            this.dataGridView1.Columns.Add("宽", "宽");
            this.dataGridView1.Columns.Add("水深", "水深");
            this.dataGridView1.Columns.Add("流量", "流量(m³/s)");
            this.dataGridView1.Columns.Add(lc1);
            this.dataGridView1.Columns.Add(lc);
            this.dataGridView1.Rows.Add("朱顺屯", "松花江", "300", "40", "15", "600", "查看与修改", "删除");
            this.dataGridView1.Rows.Add("巴彦港", "松花江", "345", "44", "13", "660", "查看与修改", "删除");
            this.dataGridView1.Rows.Add("新村港", "乌江", "333", "41", "25", "666", "查看与修改", "删除");
        }
        private void button1_Click(object sender, EventArgs e)
        {
            this.dataGridView1.Rows.Clear();

            this.dataGridView1.Rows.Add("朱顺屯", "松花江", "300", "40", "15", "600", "查看与修改", "删除");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.textBox1.Text = "";
            this.textBox2.Text = "";
        }

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex != -1)
            {
                if (this.dataGridView1.Columns[e.ColumnIndex].Name == "查看与修改")
                {
                    LYXX_SWDZ_XG xg = new LYXX_SWDZ_XG();
                    xg.Show();
                }
                if (this.dataGridView1.Columns[e.ColumnIndex].Name == "删除")
                {
                    this.dataGridView1.Rows.RemoveAt(e.RowIndex);
                }
            }
        }


    }
}
